import requests


class HeaderUtil(object):
    # 获取登录接口header的方法
    @classmethod
    def loginApi(cls):
        url = "http://ihrm-test.itheima.net/api/sys/login"
        data = {"mobile": "13800000002", "password": "123456"}
        header = {"Content-Type": "application/json"}
        resp = requests.post(url=url, headers=header, json=data)
        token = resp.json()["data"]
        return_header = {"Content-Type": "application/json", "Authorization": token}
        return return_header


if __name__ == '__main__':
    print(HeaderUtil.loginApi())
